/**
 * list_schema  获取维修人员列表
 * query_schema 查询维修人员
 * add_schema   添加维修人员
 * update_schema  修改维修人员信息
 */

const joi = require("joi")
const {
  phone,
  job_number,
  password,
  id,
  name,
  gender,
  page,
  pagesize,
} = require("../common")

const type_id = joi.string().length(32).error(new Error("类型格式有误"))

exports.list_schema = {
  query: {
    page,
    pagesize,
    type_id,
  },
}

exports.query_schema = {
  query: {
    job_number: job_number,
  },
}

exports.add_schema = {
  body: {
    job_number: job_number.required(),
    name: name.required(),
    gender: gender.required(),
    type_id: type_id.required(),
    password: password.required(),
  },
}

exports.update_schema = {
  body: {
    id: id.required(),
    job_number,
    name,
    gender,
    type_id,
    phone,
  },
}

exports.lock_schema = {
  body: {
    id: id.required(),
    idLock: joi.boolean().required().error(new Error("是否锁定有误")),
  },
}